/*
 * @Author: your name
 * @Date: 2022-03-08 15:58:35
 * @LastEditTime: 2023-11-12 20:39:30
 * @LastEditors: wuqiang
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /surpath-dray-saas/Users/wuqiang/workspace/huijun-frontend/src/pages/activation/exemption/index.tsx
 */
import React, { useEffect } from 'react'
import { useLocation } from 'react-router-dom';

import Pdfh5 from 'pdfh5'
import 'pdfh5/css/pdfh5.css'
interface Params {
  name: string
}

const Viewer = () => {

  const useQuery =  () => {
    return new URLSearchParams(useLocation().search);
  }
  const name =  useQuery().get('name')
  // const params = useParams() 
  useEffect(() => {
    // if (name === 'huigongka') {
    //   document.title = '药品目录'
    // }
    const pdfh5 = new Pdfh5('#activate-viewer', {
      pdfurl: `/pdf/${name}.pdf`
    })    
    //监听完成事件
    pdfh5.on('complete', function (status, msg, time) {
      console.log(
        '状态：' + status + '，信息：' + msg + '，耗时：' + time + '毫秒，总页数：'
      )
    })
  }, [name])

  return (
    <>
      <section id="activate-viewer"></section>
    </>
  )
}

export default Viewer
